fi.foyt.svg.svgdom.FNISVGElementControllerVaultClass = Class.create({
  initialize : function() {
    this._elementControllers = new Hash();
    this._registerElementController('rect', new fi.foyt.svg.svgdom.FNISVGRectElementController());
    this._registerElementController('circle', new fi.foyt.svg.svgdom.FNISVGCircleElementController());
    this._registerElementController('ellipse', new fi.foyt.svg.svgdom.FNISVGEllipseElementController());
    this._registerElementController('line', new fi.foyt.svg.svgdom.FNISVGLineElementController());
    this._registerElementController('polygon', new fi.foyt.svg.svgdom.FNISVGPolygonElementController());
    this._registerElementController('polyline', new fi.foyt.svg.svgdom.FNISVGPolylineElementController());
    this._registerElementController('path', new fi.foyt.svg.svgdom.FNISVGPathElementController());
    this._registerElementController('g', new fi.foyt.svg.svgdom.FNISVGGroupElementController());
  },
  getElementControllerFor : function(element) {
    if (element != null)
      return this.getElementController(element.tagName.toUpperCase());
    else
      throw new Error("Cannot return element controller for null element");
  },
  getElementController : function(elementName) {
    var controller = this._elementControllers.get(elementName.toUpperCase());
    if (!controller)
      throw new Error("Could not find elementcontroller for: " + elementName);
    else
      return controller;
  },
  _registerElementController : function(elementName, controller) {
    this._elementControllers.set(elementName.toUpperCase(), controller);
  }
});

window._svgElementControllerVault = null;

window.getSVGElementControllerVault = function() {
  if (!window._svgElementControllerVault) {
    window._svgElementControllerVault = new fi.foyt.svg.svgdom.FNISVGElementControllerVaultClass();
  }

  return window._svgElementControllerVault;
};